//
//  RBBaseDetailViewController.m
//  BaoRongApp
//
//  Created by Riber on 2017/3/15.
//  Copyright © 2017年 dai yi. All rights reserved.
//

#import "RBBaseDetailViewController.h"

@interface RBBaseDetailViewController ()

@end

@implementation RBBaseDetailViewController

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = mainBackColor;
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameDidChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
    
    if (self.backItemHidden) {
        self.navigationItem.leftBarButtonItem = nil;
    }
    else {
        UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[RBImageNamed(@"backArrow") imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)] style:(UIBarButtonItemStylePlain) target:self action:@selector(back:)];
        self.navigationItem.leftBarButtonItem = leftItem;
    }
    
    [self superCreateUI];
    [self loadSuperData];
}

//- (void)setBackItemHidden:(BOOL)backItemHidden {
//    if (!backItemHidden) {
//        
////        UIButton *leftButton = [RBFactoryMethod initWithNormalImageButtonFrame:CGRectMake(0, 0, 50, 44) normalImageName:@"detail_backarrow" selectImageName:@""];
////        leftButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
////        UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
////        self.navigationItem.leftBarButtonItem = leftItem;
//        
//        UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[RBImageNamed(@"backArrow") imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)] style:(UIBarButtonItemStylePlain) target:self action:@selector(back:)];
//        self.navigationItem.leftBarButtonItem = leftItem;
//    }
//    else {
//        self.navigationItem.leftBarButtonItem = nil;
//    }
//}

- (void)superCreateUI {
    
}

- (void)loadSuperData {
    
}

- (void)back:(UIBarButtonItem *)backItem {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)statusBarFrameDidChange:(NSNotification*)notification {
    
}

@end
